package com.higold.cloud.ui.fragment

import android.os.Bundle
import android.support.v4.app.Fragment
import com.gyf.immersionbar.ktx.immersionBar
import com.higold.cloud.R
import com.higold.cloud.base.BaseFragment
import com.higold.cloud.base.BaseFragmentAdapter
import com.higold.cloud.utils.StatusBarUtil
import kotlinx.android.synthetic.main.fragment_salesman.*

/**
 *    author : lxz
 *    date   : 2019/8/9 14:38
 *    desc   :
 */
class SalesmanFragment : BaseFragment() {

    private val tabList = ArrayList<String>()

    private val fragments = ArrayList<Fragment>()

    private var mTitle: String? = null

    companion object {
        fun getInstance(title: String): SalesmanFragment {
            val fragment = SalesmanFragment()
            val bundle = Bundle()
            fragment.arguments = bundle
            fragment.mTitle = title
            return fragment
        }
    }

    override fun getLayoutId(): Int = R.layout.fragment_salesman

    override fun initView() {

        //状态栏透明和间距处理
//        activity?.let { StatusBarUtil.setPaddingSmart(it, toolbar)
//            StatusBarUtil.darkMode(it, false)}

        tv_header_title.text = mTitle

        tabList.add("汇报日志")
        tabList.add("大区业务员")
        tabList.add("门店开发")
        fragments.add(ReportFragment.getInstance("汇报日志"))
        fragments.add(RegionalFragment.getInstance("大区业务员"))
        fragments.add(DevelopFragment.getInstance("门店开发"))

        /**
         * getSupportFragmentManager() 替换为getChildFragmentManager()
         */
        mViewPager.adapter = BaseFragmentAdapter(childFragmentManager, fragments, tabList)
        xTablayout.setupWithViewPager(mViewPager)
    }

    override fun lazyLoad() {
    }

}